<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8" />
    <title>销售系统</title>
    <link rel="stylesheet" th:href="@{/css/style.css}" />
</head>
<body>
<div class="n-support">请使用Chrome、Safari等webkit内核的浏览器！</div>
<div class="n-head">
    <div class="g-doc f-cb">
        <div class="user" th:if="${session.user == null}">请<a th:href="@{/login}">[登录]</a></div>
        <div class="user" th:if="${session.user != null && session.user.userType == 1}">
            卖家你好，<span class="name" th:text="${session.user.username}"></span>！<a th:href="@{/logout}">[退出]</a>
        </div>
        <div class="user" th:if="${session.user != null && session.user.userType == 2}">
            买家你好，<span class="name" th:text="${session.user.username}"></span>！<a th:href="@{/logout}">[退出]</a>
        </div>
        <ul class="nav">
            <li><a th:href="@{/}">首页</a></li>
            <li th:if="${session.user != null && session.user.userType == 1}"><a th:href="@{/public}">发布</a></li>
            <li th:if="${session.user != null && session.user.userType == 2}"><a th:href="@{/account}">账务</a></li>
            <li th:if="${session.user != null && session.user.userType == 2}"><a th:href="@{/settleAccount}">购物车</a></li>
        </ul>
    </div>
</div>
<div class="g-doc">
    <div class="m-tab m-tab-fw m-tab-simple f-cb">
        <div class="tab">
            <ul>
                <li><a th:href="@{/}">所有内容</a></li>
                <li class="z-sel" th:if="${session.user != null && session.user.userType == 2}"><a th:href="@{/}+'?type=1'">未购买的内容</a></li>
            </ul>
        </div>
    </div>
    <div class="n-plist">
        <ul class="f-cb" id="plist">
            <li th:id="'p-'+${commodity.id}" th:each="commodity:${commodityList}">
                <a th:href="@{/show}+'?id='+${commodity.id}" class="link">
                    <div class="img"><img th:src="${commodity.pic}" th:alt="${commodity.title}" /></div>
                    <h3>[[${commodity.title}]]</h3>
                    <div class="price">
                        <span class="v-unit">¥</span><span class="v-value">[[${commodity.price}]]</span>
                    </div>
                </a>
                <span class="u-btn u-btn-normal u-btn-xs del" th:data-del="${commodity.id}" th:if="${session.user != null && session.user.userType == 1 && (commodity.hasBuy == 0 || commodity.hasBuy == 2)}">删除</span>
            </li>
        </ul>
    </div>
</div>
<div class="n-foot">
    <p>
        版权所有：网易云课堂<a
            href="http://mooc.study.163.com/smartSpec/detail/85002.htm"
    >Java开发工程师(Web方向)</a
    >微专业团队
    </p>
</div>
<script type="text/javascript" th:src="@{/js/global.js}"></script>
<script type="text/javascript" th:src="@{/js/pageIndex.js}"></script>
</body>
</html>
